package com.gpframework.module.controller.module;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.core.controller.BaseController;
import com.gpframework.common.core.page.TableDataInfo;
import com.gpframework.module.module.domain.BrandInfo;
import com.gpframework.module.module.domain.req.BrandInfoReq;
import com.gpframework.module.module.domain.vo.BrandContactUsVo;
import com.gpframework.module.module.domain.vo.BrandInfoVo;
import com.gpframework.module.module.service.IBrandInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName BrandInfoController
 * @Author gpframework
 * @Date 2022-03-23
 * @Version 1.0.0
 * @Description 品牌信息Controller
 */
@Validated
@Api(tags = "品牌信息")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@SuppressWarnings({"rawtypes", "unchecked"})
@RequestMapping("/module/brandInfo")
public class BrandInfoController extends BaseController {

    /**
     * 品牌信息Service接口
     */
    private final IBrandInfoService iBrandInfoService;

    @ApiOperation("会员小程序 - 联系我们")
    @GetMapping("/brandContactUs")
    public TableDataInfo<BrandContactUsVo> brandContactUs(BrandInfoReq brandInfoReq) {
        startPage();
        QueryWrapper<BrandInfo> lqw = new QueryWrapper<BrandInfo>();
        brandInfoReq.generatorQuery(lqw, true);
        List<BrandInfoVo> list = iBrandInfoService.listVo(lqw);
        return getDataTable(list);
    }

}
